package caiwei.android.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import caiwei.android.R;
import caiwei.android.adapter.base.AdapterBase;
import caiwei.android.controls.SlideMenuItem;

/**
 * 滑动菜单ListView实现适配器类
 * 
 * @author caiwei
 * @date2012-3-5
 * @version 1.0
 */
public class AdapterSlideMenuList extends AdapterBase
{

	public AdapterSlideMenuList(Context pContext, List<?> pList)
	{
		super(pContext, pList);
	}

	/**
	 * 实体类，配合资源文件，用于缓存
	 * 
	 * @author caiwei
	 * @date2012-3-5
	 * @version 1.0
	 */
	private class Holder
	{
		TextView tvMenuName;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		Holder _Holder;
		if (convertView == null)
		{
			convertView=getLayoutInflater().inflate(R.layout.slidemenu_list_item, null);
			_Holder=new Holder();
			_Holder.tvMenuName=(TextView)convertView.findViewById(R.id.tvMenuName);
			convertView.setTag(_Holder);
		}else {
			_Holder=(Holder)convertView.getTag();
		}
		SlideMenuItem _Item=(SlideMenuItem)getList().get(position);
		_Holder.tvMenuName.setText(_Item.getTitle());
		return convertView;
	}

}
